<template>
  <ul class="todo-main">
    <!--  :todo="todo" 数据批量传递给子组件  -->
    <Item
        v-for="todo in todoList"
        :key="todo.id"
        :todo="todo"
        :changeChecked="changeChecked"
        :deleteTodo="deleteTodo"
    />
  </ul>
</template>

<script lang="ts">
import {defineComponent} from "vue";
import Item from "@/components/List/Item/index.vue";
export  default defineComponent({
  name: "List",
  components:{Item}

})
</script>
<script setup lang="ts">
import {todoListType} from '@/types/todoList'

//接收props传参定义类型（事件函数一般都没有返回值，返回值类型写void）
interface propsType{
  todoList:todoListType,
  changeChecked:(id:string,done:boolean)=>void,
  deleteTodo:(id:string)=>void,

}
//接收props传参   todoList数据
defineProps<propsType>()
</script>
<style scoped>
.todo-main {
  margin-left: 0px;
  border: 1px solid #ddd;
  border-radius: 2px;
  padding: 0px;
}

.todo-empty {
  height: 40px;
  line-height: 40px;
  border: 1px solid #ddd;
  border-radius: 2px;
  padding-left: 5px;
  margin-top: 10px;
}
</style>
